; Do yes do, that thing you do, so weeeelllll... (refrain)
xbutton 270 130 80 15 START
tw_stopflag = 0 ; reset abort flag
lvmulti wrap.gc 1 first
if $tw_select = ""
ezreq "I would.. if I had\nsome files.." OK ""
stop
endif
if $tw_ext = 0 ; check & warn if files will be overwriten
if $tw_newdir = 0
ezreq 'With the current settings\nselected files will be\nOverWriten !\n\nIf any file is not a pure\ntext file, it may be trashed!\n\nAre you sure ?\n' "Continue|CANCEL" tw_choice
if $tw_choice = 0
stop
endif
endif
endif
guiwindow wrap.gc wait
gosub wrap.gc setup ; construct the command line
launch 1 'wrap $tw_select $tw_options' ; and launch the first file
xOnReturn 1 ; upon returning, launch the next file
lvmulti wrap.gc 1 off
if $tw_stopflag = 1 ; check if user has aborted meanwhile
guiwindow wrap.gc resume
lvdir wrap.gc 1 refresh
stop
endif
lvmulti wrap.gc 1 next
if $tw_select > ""
gosub wrap.gc setup
launch 1 'wrap $tw_select $tw_options'
else
guiwindow wrap.gc resume
if $tw_newdir = 1
lvdir wrap.gc 1 #$tw_dest
setwintitle wrap.gc '$tw_dest '
else
lvdir wrap.gc 1 refresh
endif
endif
xroutine setup ; construct the options command line
tw_options = ""
extract tw_select file tw_file
if $tw_ext = 1
extract tw_file unquote tw_file2
appvar tw_file2 .wrap ; add the file extension
tw_file = '\"$tw_file2\"'
endif
if $tw_newdir = 1
JoinFile $tw_dest $tw_file tw_file ; save to new dir
else
extract tw_select path tw_path
JoinFile $tw_path $tw_file tw_file ; or to the same dir
endif
tw_options = '$tw_file ' ; this is our correct file name